package inabit.inabitcompiler.productions.variable.types;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**P -> GG'*/
/**@author Rafael Rocha*/
public class P_Rule extends Production{
	private NonTerminal G;
	private NonTerminal G1;
	
	public P_Rule() {
		super("P");
	}
	
	public Symbol[] production(final NonTerminal nonTerminal) {
		G = new NonTerminal("G");
		G1 = new NonTerminal("G'");
		
		Symbol[] symbols = {
				G,
				G1,
				new InabitSemanticAction(nonTerminal) {
					@Override
					public void execute() throws Exception {
						nonTerminal.code = G.code + G1.code;
					}
				}
		};
		return symbols;
	}
}
